package com.video.moderation.repository;

import com.video.moderation.entity.ChatMessage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ChatMessageRepository extends JpaRepository<ChatMessage, Long> {
    
    @Query(value = "SELECT cm.session_id FROM ChatMessage cm WHERE cm.from_user_id = :fromUserId AND cm.to_user_id = :toUserId")
    List<String> queryPid(@Param("fromUserId") Long fromUserId, @Param("toUserId") Long toUserId);
    
}
